package org.ohos.rajawali3d.examples.examples.effects;

import ohos.app.Context;
import org.ohos.rajawali3d.examples.examples.AExampleFragment;
import org.ohos.rajawali3d.examples.examples.effects.particles.ExampleParticleSystem;

public class ParticlesFragment extends AExampleFragment {

    @Override
    public AExampleRenderer createRenderer() {
        return new ParticlesRenderer(getContext(), this);
    }

    private final class ParticlesRenderer extends AExampleFragment.AExampleRenderer {
        private final int MAX_FRAMES = 200;
        private int mFrameCount;
        private ExampleParticleSystem mParticleSystem;

        public ParticlesRenderer(Context context, AExampleFragment fragment) {
            super(context, fragment);
        }

        @Override
        protected void initScene() {
            getCurrentCamera().setPosition(0, 0, 10);
            // TODO add particle system
			/*
			mParticleSystem = new ExampleParticleSystem();
			ParticleMaterial material = new ParticleMaterial();
			try {
				material.addTexture(new Texture(ResourceTable.Media_particle));
			} catch (TextureException e) {
				e.printStackTrace();
			}
			mParticleSystem.setMaterial(material);
			mParticleSystem.setPointSize(100);
			addChild(mParticleSystem);
			*/
        }

        @Override
        protected void onRender(long elapsedRealtime, double deltaTime) {
            super.onRender(elapsedRealtime, deltaTime);
			/*
			mParticleSystem.setTime((float) mFrameCount * .2f);

			if (mFrameCount++ >= MAX_FRAMES)
				mFrameCount = 0;
				*/
        }

    }

}
